// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CodeMustNotContainEmptyStatements.cs" company="StyleCop for ReSharper Development Team">
//   Copyright (c) StyleCop for ReSharper Development Team. All rights reserved.
// </copyright>
// <summary>
//   Defines the CodeMustNotContainEmptyStatements type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace StyleCop.For.ReSharper.BulbItems.Readability
{
    #region Using Directives

    using JetBrains.ProjectModel;
    using JetBrains.TextControl;

    using StyleCop.For.ReSharper.BulbItems.Framework;

    #endregion

    /// <summary>
    /// QuickFix action which replaces ";;" with ";".
    /// </summary>
    public class CodeMustNotContainEmptyStatements : V5BulbItemImpl
    {
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            var documentation = this.DocumentRange.GetText().Replace(";;", ";");

            textControl.Document.ReplaceText(this.DocumentRange.TextRange, documentation);
        }
    }
}